/**
 * Selling Partner API for Replenishment
 * The Selling Partner API for Replenishment (Replenishment API) provides programmatic access to replenishment program metrics and offers. These programs provide recurring delivery of any replenishable item at a frequency chosen by the customer.  The Replenishment API is available worldwide wherever Amazon Subscribe & Save is available or is supported. The API is available to vendors and FBA selling partners.
 *
 * The version of the OpenAPI document: 2022-11-07
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 *
 */

import { ApiClient } from '../ApiClient.js'
import { TimeInterval } from './TimeInterval.js'

/**
 * The GetSellingPartnerMetricsResponseMetric model module.
 * @module replenishment_v2022_11_07/model/GetSellingPartnerMetricsResponseMetric
 * @version 2022-11-07
 */
export class GetSellingPartnerMetricsResponseMetric {
  /**
   * Constructs a new <code>GetSellingPartnerMetricsResponseMetric</code>.
   * An object which contains metric data for a selling partner.
   * @alias module:replenishment_v2022_11_07/model/GetSellingPartnerMetricsResponseMetric
   * @class
   */
  constructor () {
  }

  /**
   * Constructs a <code>GetSellingPartnerMetricsResponseMetric</code> from a plain JavaScript object, optionally creating a new instance.
   * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
   * @param {Object} data The plain JavaScript object bearing properties of interest.
   * @param {GetSellingPartnerMetricsResponseMetric} obj Optional instance to populate.
   * @return {GetSellingPartnerMetricsResponseMetric} The populated <code>GetSellingPartnerMetricsResponseMetric</code> instance.
   */
  static constructFromObject (data, obj) {
    if (data) {
      switch (typeof data) {
        case 'string':
          obj = String(data)
          break
        case 'number':
          obj = Number(data)
          break
        case 'boolean':
          obj = Boolean(data)
          break
      }
      obj = obj || new GetSellingPartnerMetricsResponseMetric()
      if (data.hasOwnProperty('notDeliveredDueToOOS')) { obj.notDeliveredDueToOOS = ApiClient.convertToType(data.notDeliveredDueToOOS, 'Number') }
      if (data.hasOwnProperty('totalSubscriptionsRevenue')) { obj.totalSubscriptionsRevenue = ApiClient.convertToType(data.totalSubscriptionsRevenue, 'Number') }
      if (data.hasOwnProperty('shippedSubscriptionUnits')) { obj.shippedSubscriptionUnits = ApiClient.convertToType(data.shippedSubscriptionUnits, 'Number') }
      if (data.hasOwnProperty('activeSubscriptions')) { obj.activeSubscriptions = ApiClient.convertToType(data.activeSubscriptions, 'Number') }
      if (data.hasOwnProperty('subscriberAverageRevenue')) { obj.subscriberAverageRevenue = ApiClient.convertToType(data.subscriberAverageRevenue, 'Number') }
      if (data.hasOwnProperty('nonSubscriberAverageRevenue')) { obj.nonSubscriberAverageRevenue = ApiClient.convertToType(data.nonSubscriberAverageRevenue, 'Number') }
      if (data.hasOwnProperty('lostRevenueDueToOOS')) { obj.lostRevenueDueToOOS = ApiClient.convertToType(data.lostRevenueDueToOOS, 'Number') }
      if (data.hasOwnProperty('subscriberAverageReorders')) { obj.subscriberAverageReorders = ApiClient.convertToType(data.subscriberAverageReorders, 'Number') }
      if (data.hasOwnProperty('nonSubscriberAverageReorders')) { obj.nonSubscriberAverageReorders = ApiClient.convertToType(data.nonSubscriberAverageReorders, 'Number') }
      if (data.hasOwnProperty('couponsRevenuePenetration')) { obj.couponsRevenuePenetration = ApiClient.convertToType(data.couponsRevenuePenetration, 'Number') }
      if (data.hasOwnProperty('revenueFromSubscriptionsWithMultipleDeliveries')) { obj.revenueFromSubscriptionsWithMultipleDeliveries = ApiClient.convertToType(data.revenueFromSubscriptionsWithMultipleDeliveries, 'Number') }
      if (data.hasOwnProperty('revenueFromActiveSubscriptionsWithSingleDelivery')) { obj.revenueFromActiveSubscriptionsWithSingleDelivery = ApiClient.convertToType(data.revenueFromActiveSubscriptionsWithSingleDelivery, 'Number') }
      if (data.hasOwnProperty('revenueFromCancelledSubscriptionsAfterSingleDelivery')) { obj.revenueFromCancelledSubscriptionsAfterSingleDelivery = ApiClient.convertToType(data.revenueFromCancelledSubscriptionsAfterSingleDelivery, 'Number') }
      if (data.hasOwnProperty('subscriberRetentionFor30Days')) { obj.subscriberRetentionFor30Days = ApiClient.convertToType(data.subscriberRetentionFor30Days, 'Number') }
      if (data.hasOwnProperty('subscriberRetentionFor90Days')) { obj.subscriberRetentionFor90Days = ApiClient.convertToType(data.subscriberRetentionFor90Days, 'Number') }
      if (data.hasOwnProperty('revenuePenetrationFor0PercentSellerFunding')) { obj.revenuePenetrationFor0PercentSellerFunding = ApiClient.convertToType(data.revenuePenetrationFor0PercentSellerFunding, 'Number') }
      if (data.hasOwnProperty('revenuePenetrationFor5PercentSellerFunding')) { obj.revenuePenetrationFor5PercentSellerFunding = ApiClient.convertToType(data.revenuePenetrationFor5PercentSellerFunding, 'Number') }
      if (data.hasOwnProperty('revenuePenetrationFor10PercentSellerFunding')) { obj.revenuePenetrationFor10PercentSellerFunding = ApiClient.convertToType(data.revenuePenetrationFor10PercentSellerFunding, 'Number') }
      if (data.hasOwnProperty('revenuePenetrationFor5PlusPercentSellerFunding')) { obj.revenuePenetrationFor5PlusPercentSellerFunding = ApiClient.convertToType(data.revenuePenetrationFor5PlusPercentSellerFunding, 'Number') }
      if (data.hasOwnProperty('shareOfCouponSubscriptions')) { obj.shareOfCouponSubscriptions = ApiClient.convertToType(data.shareOfCouponSubscriptions, 'Number') }
      if (data.hasOwnProperty('timeInterval')) { obj.timeInterval = TimeInterval.constructFromObject(data.timeInterval) }
      if (data.hasOwnProperty('currencyCode')) { obj.currencyCode = ApiClient.convertToType(data.currencyCode, 'String') }
    }
    return obj
  }
}

/**
 * The percentage of items that were not shipped out of the total shipped units over a period of time due to being out of stock. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} notDeliveredDueToOOS
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.notDeliveredDueToOOS = undefined

/**
 * The revenue generated from subscriptions over a period of time. Applicable for both the PERFORMANCE and FORECAST timePeriodType.
 * @member {Number} totalSubscriptionsRevenue
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.totalSubscriptionsRevenue = undefined

/**
 * The number of units shipped to the subscribers over a period of time. Applicable for both the PERFORMANCE and FORECAST timePeriodType.
 * @member {Number} shippedSubscriptionUnits
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.shippedSubscriptionUnits = undefined

/**
 * The number of active subscriptions present at the end of the period. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} activeSubscriptions
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.activeSubscriptions = undefined

/**
 * The average revenue per subscriber of the program over a period of past 12 months for sellers and 6 months for vendors. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} subscriberAverageRevenue
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.subscriberAverageRevenue = undefined

/**
 * The average revenue per non-subscriber of the program over a period of past 12 months for sellers and 6 months for vendors. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} nonSubscriberAverageRevenue
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.nonSubscriberAverageRevenue = undefined

/**
 * The revenue that would have been generated had there not been out of stock. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} lostRevenueDueToOOS
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.lostRevenueDueToOOS = undefined

/**
 * The average reorders per subscriber of the program over a period of 12 months. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} subscriberAverageReorders
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.subscriberAverageReorders = undefined

/**
 * The average reorders per non-subscriber of the program over a period of past 12 months. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} nonSubscriberAverageReorders
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.nonSubscriberAverageReorders = undefined

/**
 * The percentage of revenue from ASINs with coupons out of total revenue from all ASINs. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} couponsRevenuePenetration
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.couponsRevenuePenetration = undefined

/**
 * The subscription revenue generated from subscriptions with over two deliveries over the past 12 months. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} revenueFromSubscriptionsWithMultipleDeliveries
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.revenueFromSubscriptionsWithMultipleDeliveries = undefined

/**
 * The subscription revenue generated from active subscriptions with one delivery over the past 12 months. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} revenueFromActiveSubscriptionsWithSingleDelivery
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.revenueFromActiveSubscriptionsWithSingleDelivery = undefined

/**
 * The subscription revenue generated from subscriptions which are cancelled after one delivery over the past 12 months. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} revenueFromCancelledSubscriptionsAfterSingleDelivery
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.revenueFromCancelledSubscriptionsAfterSingleDelivery = undefined

/**
 * The percentage of subscriptions retained after 30 days of subscription creation. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} subscriberRetentionFor30Days
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.subscriberRetentionFor30Days = undefined

/**
 * The percentage of subscriptions retained after 90 days of subscription creation. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} subscriberRetentionFor90Days
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.subscriberRetentionFor90Days = undefined

/**
 * The percentage of subscription revenue generated by offers with 0% seller-funded discount over the last 12 months. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} revenuePenetrationFor0PercentSellerFunding
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.revenuePenetrationFor0PercentSellerFunding = undefined

/**
 * [Applicable only for Sellers] The percentage of subscription revenue generated by offers with 5% seller-funded discount over the last 12 months. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} revenuePenetrationFor5PercentSellerFunding
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.revenuePenetrationFor5PercentSellerFunding = undefined

/**
 * [Applicable only for Sellers] The percentage of subscription revenue generated by offers with 10% seller-funded discount over the last 12 months. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} revenuePenetrationFor10PercentSellerFunding
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.revenuePenetrationFor10PercentSellerFunding = undefined

/**
 * [Applicable only for vendors] The percentage of subscription revenue generated by offers with 5% or above seller-funded discount over the last 12 months. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} revenuePenetrationFor5PlusPercentSellerFunding
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.revenuePenetrationFor5PlusPercentSellerFunding = undefined

/**
 * The percentage of new subscriptions acquired through coupons. Applicable to PERFORMANCE timePeriodType.
 * @member {Number} shareOfCouponSubscriptions
 * @type {Number}
 */
GetSellingPartnerMetricsResponseMetric.prototype.shareOfCouponSubscriptions = undefined

/**
 * @member {TimeInterval} timeInterval
 * @type {TimeInterval}
 */
GetSellingPartnerMetricsResponseMetric.prototype.timeInterval = undefined

/**
 * The currency code in ISO 4217 format.
 * @member {String} currencyCode
 * @type {String}
 */
GetSellingPartnerMetricsResponseMetric.prototype.currencyCode = undefined
